package me.ereach.list;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ListDemo {
    public static void show() {
        List<String> list = new ArrayList<>();

        Collections.addAll(list,"a", "b", "c", "e", "b");
        list.set(0, "a+");

        System.out.println(list.get(0));
        System.out.println(list);

        list.remove(0);
        System.out.println(list);

        System.out.println(list.indexOf("b"));  // print 0
        System.out.println(list.indexOf("a+")); // print -1
        System.out.println(list.lastIndexOf("b"));  // print 3
        System.out.println(list.subList(1, 3)); // [c, e]
    }
}
